import { CreditType, Tags, ShopGoodParams, ShopGoodStatus, ShopGoodUnit, ShopGoodType, Entity, PrimaryUuid, CreateDate, Boolean, UpdateDate, SysUserId, Price, Title, Desc, Image, Images, Digdit, RichText, CreateUserId, ShopPCategoryId, ShopCCategoryId, Code, Jsonb, Text, Uuid, AutoIncrementId, Money, DateTime } from '@sker/core'
@Entity({
    name: 'shop_good'
})
export class ShopGood {
    static title: string = `商品`;
    static resource: string = `shop_good`;

    @PrimaryUuid({
        primaryKeyConstraintName: "PK_SHOP_GOOD_ID"
    })
    id!: string;

    @AutoIncrementId()
    good_id: number;

    @Tags({
        comment: '标签'
    })
    tags!: string[]

    @Jsonb({
        comment: '所属分类',
        nullable: true,
        default: []
    })
    category!: string[]

    @Text({ comment: '打平分类', nullable: true, default: '' })
    category_flat!: string[]

    @Code({ comment: '商品条码', nullable: true })
    sn: string;

    @Uuid({ nullable: true, comment: '包邮策略' })
    postage_id: string;

    @Money({ nullable: true, comment: '税点', default: 0 })
    tax: string;

    @Title({ comment: '商品名' })
    title!: string;

    @Desc({ comment: '简介' })
    desc!: string;

    @Jsonb({ comment: '附加信息', nullable: true, default: [] })
    other: any

    @Image({ comment: '缩略图' })
    cover!: string;

    @Images({ comment: '图集', nullable: true })
    images!: string[]

    @RichText({ comment: '详情' })
    content!: string;

    @Digdit({ comment: '顺序' })
    displayorder!: number;

    @ShopGoodStatus({ comment: '状态' })
    status!: number;

    @ShopGoodType({ comment: '商品类型' })
    type!: number;

    @ShopGoodUnit({ comment: '商品单位' })
    unit!: string;

    @Price({ comment: '市场价' })
    marketprice!: number;

    @Price({ comment: '销售价' })
    productprice: number;

    @Price({ comment: '成本价' })
    costprice!: number;

    @Price({ comment: '原价' })
    originalprice: number;

    @Digdit({ comment: '库存数量' })
    stock: number;

    @Digdit({ comment: '告警库存' })
    warn_stock: number;

    @DateTime({ comment: '告警时间' })
    warn_date: Date;

    @Digdit({ comment: '销量' })
    sales!: number;

    @Digdit({ comment: '限购数量' })
    maxbuy!: number;

    @Digdit({ comment: '购买可得积分' })
    credit!: number;

    @CreditType({ comment: '积分类型' })
    credit_type!: number;

    @Boolean({ comment: '开启规格', default: false })
    has_option!: boolean;

    @Boolean({ label: '推荐', default: false })
    is_recommend: boolean;

    @ShopGoodParams({ comment: '规格参数', nullable: true, default: {} })
    params!: any;

    @CreateUserId({ comment: '上传人', nullable: true })
    create_uid!: string;

    @CreateDate({
        comment: '创建日期'
    })
    create_date!: Date;

    @UpdateDate({
        comment: '更新日期'
    })
    update_date!: Date;

    @Uuid({ nullable: true, comment: '供货商ID' })
    provider_id: string;
}
